<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Type</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/layui/css/layui.css">

    <link rel="icon" href="${pageContext.request.contextPath}/assets/images/favicon.png" type="image/png">
    <title>添加商品属性</title>
    <!--Begin  Page Level  CSS -->
    <link href="${pageContext.request.contextPath}/assets/plugins/morris-chart/morris.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet"/>
    <!--End  Page Level  CSS -->
    <link href="${pageContext.request.contextPath}/assets/css/icons.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/css/style.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/css/responsive.css" rel="stylesheet">
    <script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-144208445-2"></script>

    <link href="${pageContext.request.contextPath}/assets/css/style.css" rel="stylesheet">
</head>
<body class="sticky-header">


<!--Start left side Menu-->
<jsp:include page="../inc/left.jsp"/>
<!--End left side menu-->

<!-- main content start-->
<div class="main-content">
    <!-- header section start-->
    <jsp:include page="../inc/header.jsp"/>
    <!-- header section end-->


    <!--body wrapper start-->
    <div class="wrapper">

        <!--Start Page Title-->
        <div class="page-title-box">
            <h4 class="page-title">商品属性</h4>
            <ol class="breadcrumb">
                <li>
                    <a href="${pageContext.request.contextPath}/index">首页</a>
                </li>
                <li>
                    <a href="#">商品</a>
                </li>
                <li class="active">
                    商品属性
                </li>
            </ol>
            <div class="clearfix"></div>
        </div>
        <!--End Page Title-->
        <br>
        <div data-v-2adcf524="" class="header-title" style="background-color: white;height: 50px;line-height: 50px">
            <div class="el-card__body"><i data-v-2adcf524="" class="el-icon-tickets" style="margin-top: 5px;"></i> <span
                    data-v-2adcf524="" style="margin-left: 20px;line-height: 50px">数据列表</span>
                <a href="${pageContext.request.contextPath}/goods/typeAttributeList/add?id=${productAttributeCategory.id}&types=${type}"
                   style="display: inline-block;margin-left: 80%;margin-top: -40px;outline: none"
                   ><span class="btn-info" style="padding: 5px;font-weight: normal">&nbsp;&nbsp;添加&nbsp;&nbsp;</span>
                </a>
            </div>
        </div>
        <!--Start row-->
        <div class="row">
            <div class="col-md-12">
                <div class="white-box">
                    <div class="table-responsive">
                        <table id="example" class="table" style="text-align: center">
                            <thead>
                            <tr>
                                <th style="text-align: center">编号</th>
                                <th style="text-align: center">商品类型</th>
                                <th style="text-align: center">属性名称</th>
                                <th style="text-align: center">属性是否可选</th>
                                <th style="text-align: center">可选值列表</th>
                                <th style="text-align: center">优先级</th>
                                <th style="text-align: center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${productAttributeList2.list}" var="p">
                                <tr>
                                    <td>${p.id}</td>
                                    <td>${p.productAttributeCategoryId}</td>
                                    <td>${p.name}</td>
                                    <td>${p.selectType==0?'唯一':p.selectType==1?'单选':'多选'}</td>
                                    <td>${p.inputList}</td>
                                    <td>${p.sort}</td>
                                    <td class="el-table_18_column_134 is-center ">
                                        <div class="cell">
                                            <button  data-v-2adcf524="" type="button"
                                                    class="btn btn-info">
                                                <a style="color: white;outline: none"
                                                   href="${pageContext.request.contextPath}/goods/typeAttributeList/change?per=${productAttributeCategory.id}&ids=${p.id}&types=${type}">编辑</a>
                                            </button>
                                            <input style="outline: none" type="button"
                                                   class="btn btn-danger" onclick="del(${p.id})" value="删除"/>
                                        </div>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>


                        <%--分页--%>
                        <form action="" method="post" class="form-group" >
                            <nav aria-label="..." style="text-align: left">
                                <ul class="pagination">
                                    <li class="disabled">
                                        <a href="#" aria-label="Next">
                                            <span aria-hidden="true">共${productAttributeList2.total}条</span></a>
                                    </li>
                                    <li style="float: left">
                                        <select  onchange="changes()" name="pageSizeS" class="selectC" style="border-left: none;border-right: none;height: 34px;border-top: 1px solid rgb(221,221,221);border-bottom: 1px solid rgb(221,221,221)">
                                            <option value="5" ${productAttributeList2.pageSize==null?"selected":""}>&nbsp;5条/页</option>
                                            <option value="10" ${productAttributeList2.pageSize==10?"selected":""}>10条/页</option>
                                            <option value="15" ${productAttributeList2.pageSize==15?"selected":""}>15条/页</option>
                                            <option value="20" ${productAttributeList2.pageSize==20?"selected":""}>20条/页</option>
                                        </select>
                                    </li>
                                    <li class="${productAttributeList2.pageNum==1?'disabled':''}">
                                        <a href="${pageContext.request.contextPath}/goods/attributeList?page=${productAttributeList2.pageNum>1?productAttributeList2.pageNum-1:1}&id=${productAttributeCategory.id}&type=${type}"
                                           aria-label="Next">
                                            <span aria-hidden="true">上一页</span></a>
                                    </li>
                                    <c:forEach begin="1" step="1" end="${productAttributeList2.pages}" var="i">
                                        <li class="${productAttributeList2.pageNum==i?'active':''}">
                                            <a href="${pageContext.request.contextPath}/goods/attributeList?page=${i}&id=${productAttributeCategory.id}&type=${type}">
                                                    ${i} <span class="sr-only">(current)</span>
                                            </a>
                                        </li>
                                    </c:forEach>
                                    <li class="${productAttributeList2.pageNum>=productAttributeList2.pages?'disabled':''}">
                                        <a id="next"
                                           href="${pageContext.request.contextPath}/goods/attributeList?page=${productAttributeList2.pageNum<productAttributeList2.pages?productAttributeList2.pageNum+1:productAttributeList2.pages}&id=${productAttributeCategory.id}&type=${type}"
                                           aria-label="Next">
                                            <span aria-hidden="true">下一页</span></a>
                                    </li>
                                    <li style="float: left;">
                                        <span style="height: 34px">前往<input class="pageSize2" onchange="changeIn()" style="text-align: center;width: 30px;border: 1px solid rgb(221,221,221)" />页</span>
                                    </li>
                                </ul>
                            </nav>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <!--End row-->
    </div>
    <!-- End Wrapper-->
    <!--Start  Footer -->

    <jsp:include page="../inc/footer.jsp"/>
    <!--End footer -->
    <!--End main content -->

    <script>
        function del(id) {
            $.post("${pageContext.request.contextPath}/goods/typeAttributeList/del", {id}, function (response) {
                $('#num').val(response.id);
                layer.open({
                    id: id,
                    title: ["属性编号:" + id + " 提示！", "font-size: 22px;font-weight: bold;"],
                    type: 1,
                    area: ["400px", "200px"],
                    content: $('#d')
                });
            })
        }
        function changes(){
            console.info( $(".selectC").val());
            location.href="${pageContext.request.contextPath}/goods/attributeList?page=1"+"&pageSize="+ $(".selectC").val()+"&id="+`${productAttributeCategory.id}`+"&type="+${type};
        }
        function changeIn(){
            console.info( $(".pageSize2").val());
            location.href="${pageContext.request.contextPath}/goods/attributeList?page="+$(".pageSize2").val()+"&pageSize="+ ${productAttributeList2.pageSize}+"&id="+`${productAttributeCategory.id}`+"&type="+${type};
        }
    </script>
    <!--Begin core plugin -->
    <script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/assets/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/assets/plugins/moment/moment.js"></script>
    <script src="${pageContext.request.contextPath}/assets/js/jquery.slimscroll.js "></script>
    <script src="${pageContext.request.contextPath}/assets/js/jquery.nicescroll.js"></script>
    <script src="${pageContext.request.contextPath}/assets/js/functions.js"></script>
    <!-- End core plugin -->
    <!--Begin Page Level Plugin-->
    <script src="${pageContext.request.contextPath}/assets/pages/table-data.js"></script>
    <script src="${pageContext.request.contextPath}/assets/layui/layui.js"></script>
    <!--End Page Level Plugin-->

</body>
<div id="d" style="display: none;">
    <form class="layui-form" id="del-form" action="${pageContext.request.contextPath}/goods/typeAttributeList/dell"
          method="post">
        <br>
        <p class="layui-form-item center" style="text-indent: 20px">
            <span style="color: red">*</span><span style="font-weight: bold;font-size: 20px;">确定要删除属性</span><input
                style="width: 50px;outline: none;border: 1px solid rgb(221,221,221);text-align: center" id="num" name="id"
                readonly><span style="font-weight: bold;font-size: 20px;">吗？</span>
        </p>
        <div class="layui-form-item">
            <div class="layui-input-block" style="margin-left: 150px">
                <input style="height: 40px;outline: none" class="layui-btn" type="submit" value="确定"/>
                &emsp;&emsp;
                <button type="submit" name="btn" value="9"
                        style="border: none;height: 39px;width: 65px;line-height: 100%;outline: none">
                    取消
                </button>
            </div>
        </div>
    </form>
</div>
</html>
